package com.szpx.controller.ZJHController;

public class Resp<T> {
    private int code;
    private String msg;
    private long count;
    private T data;

    public Resp(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Resp(int code, String msg, long count, T data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public long getCount() {
        return count;
    }

    public void setCount(long count) {
        this.count = count;
    }

    public static <T> Resp<T> success(T t, long count) {
        return new Resp<>(0, "请求成功", count,t);
    }
    public static <T> Resp<T> success() {
        return new Resp<>(0, "请求成功", 0,null);
    }
    public static <T> Resp<T> error(String msg) {
        return new Resp<>(1, msg, 0,null);
    }
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
